package com.lavegue.common;

import java.util.Map;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

/**
 * author: luoweibin
 * date:2011-12-19
 * description:
 *
 */
public class AuthInterceptor extends AbstractInterceptor  {

	public String intercept(ActionInvocation actionInvocation) throws Exception {
		 ActionContext actionContext = actionInvocation.getInvocationContext();
	       Map session = actionContext.getSession();
	         
	     //except login action25.      
			Object action = actionInvocation.getAction();
//	        if (action instanceof AdminLoginAction) {
//	            return actionInvocation.invoke();
//	        }
	       //check session30.     
			if(session.get(Constants.SESSION_USER) == null ){ 
	            return "login";
	        }
	        return actionInvocation.invoke();//go on
	}

}

